package com.nxn.core.service.impl;

import java.io.Serializable;
import java.util.List;

import com.nxn.core.dao.EntityDao;
import com.nxn.core.service.EntityManager;

/**
 * This class serves as the Base class for all other Managers - namely to hold
 * common CRUD methods that they might all use. You should only need to extend
 * this class when your require custom CRUD logic.
 *
 * @param <T>  a type variable
 * @param <PK> the primary key for that type
 * @author Michael
 */
public abstract class EntityManagerImpl<T, PK extends Serializable> 
	extends GenericManagerImpl<T, PK> implements EntityManager<T, PK> {

	public abstract EntityDao<T, PK> getSearchImpl();
	
	public T get(PK id) {
		return getSearchImpl().get(id);
	}

    public List<T> getAll() {
        return getSearchImpl().getAll();
    }

    public boolean exists(PK id) {
        return getSearchImpl().exists(id);
    }

    public void remove(PK id) {
    	getSearchImpl().remove(id);
    }
    
    public List<T> findByProperty(String propertyName, Object value) {
    	return getSearchImpl().findByProperty(propertyName, value);
    }
}
